#!f:/perl/bin/perl

use strict;

use LWP::UserAgent;
use HTTP::Request;
use Net::SSH::W32Perl;

#make request
my $agent= new LWP::UserAgent;
$agent->agent("Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.1) Gecko/20020823 Netscape/7.0" . $agent->agent);
print "requesting";
$agent->timeout(5);  #30 second timeout
my $res= $agent->get('http://www.wigan-warriors.com/cgi-bin/wigan?CookieTest=True');
if ($res->is_success) {
	print "Sucess!\n".$res->content;
	#exit(0);
} else {
	print "Fail";
}


#if failed do cad
my $ssh = Net::SSH::W32Perl->new("wigan.vmadmin.bytemark.co.uk");
$ssh->login('wigan', '92uA4FApm1l');
my($stdout, $stderr, $exit) = $ssh->cmd('status');
print "stdout: $stdout\n";
print "stderr: $stderr\n";
print "exit: $exit\n";

#if stil failed do rescuehalt